package com.echo.fm.user.role;

import java.util.List;

import org.hibernate.criterion.Criterion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.echo.fm.content.systemAction.model.SystemAction;
import com.echo.fm.platform.auth.model.RoleAuth;
import com.echo.fm.user.role.model.Role;
import com.echo.util.ErrorException;

@Service("roleService")
public class DefaultRoleServiceImpl implements IRoleService {
	@Autowired
	@Qualifier("rolePersistence")
	IRolePersistence rolePersistence;

	public void createRole(Role role) throws ErrorException {
		rolePersistence.createRole(role);
	}

	public void deleteRole(Role role) throws ErrorException {
		rolePersistence.deleteRole(role);
	}

	public void updateRole(Role role) throws ErrorException {
		rolePersistence.updateRole(role);
	}

	public Role searchRoleById(String id) throws ErrorException {
		return rolePersistence.searchRoleById(id);
	}

	public List<Role> searchRoleList(List<Criterion> criterions) throws ErrorException {
		return rolePersistence.searchRoleList(criterions);
	}

	public SystemAction searchSystemAction(String id) throws ErrorException {
		return rolePersistence.searchSystemAction(id);
	}

	public void insertRoleAuth(RoleAuth roleAuth) throws ErrorException {
		rolePersistence.insertRoleAuth(roleAuth);

	}

	public List<RoleAuth> searchRoleAuthIdByRoleId(List<Criterion> criterions) throws ErrorException {
		return rolePersistence.searchRoleAuthIdByRoleId(criterions);
	}

	public void deleteRoleAuthByRoleId(Integer roleId) throws ErrorException {
		rolePersistence.deleteRoleAuthByRoleId(roleId);

	}

	public void insertRoleAuth(List<RoleAuth> ralist) throws ErrorException {
		rolePersistence.insertRoleAuth(ralist);
	}

}
